﻿namespace CommonData.Entity
{
    using CommonData.Model.Core;
    using System;
    using System.Collections.Generic;
    using System.Reflection;

    [Serializable]
    public class TableInfo : BaseEntity
    {
        private ColumnAttribute[] columns;
        private IDictionary<string, ColumnAttribute> dicColumns;
        private IDictionary<string, FieldInfo> dicFields;
        private IDictionary<string, LinkTableAttribute> dicLinkTable;
        private IDictionary<string, LinkTablesAttribute> dicLinkTables;
        private IDictionary<string, PropertyInfo> dicProperties;
        private FieldInfo[] fields;
        private LinkTableAttribute[] linkTable;
        private LinkTablesAttribute[] linkTables;
        private PropertyInfo[] properties;
        private TableAttribute table;

        public TableInfo()
        {
            this.dicColumns = new Dictionary<string, ColumnAttribute>();
            this.dicFields = new Dictionary<string, FieldInfo>();
            this.dicProperties = new Dictionary<string, PropertyInfo>();
            this.dicLinkTable = new Dictionary<string, LinkTableAttribute>();
            this.dicLinkTables = new Dictionary<string, LinkTablesAttribute>();
        }

        public TableInfo(TableAttribute table, ColumnAttribute[] columns, FieldInfo[] fields, PropertyInfo[] properties, LinkTableAttribute[] linkTable, LinkTablesAttribute[] linkTables)
        {
            this.dicColumns = new Dictionary<string, ColumnAttribute>();
            this.dicFields = new Dictionary<string, FieldInfo>();
            this.dicProperties = new Dictionary<string, PropertyInfo>();
            this.dicLinkTable = new Dictionary<string, LinkTableAttribute>();
            this.dicLinkTables = new Dictionary<string, LinkTablesAttribute>();
            this.table = table;
            this.columns = columns;
            this.fields = fields;
            this.properties = properties;
            this.linkTable = linkTable;
            this.linkTables = linkTables;
        }

        public ColumnAttribute[] Columns
        {
            get
            {
                return this.columns;
            }
            set
            {
                this.columns = value;
            }
        }

        public IDictionary<string, ColumnAttribute> DicColumns
        {
            get
            {
                return this.dicColumns;
            }
            set
            {
                this.dicColumns = value;
            }
        }

        public IDictionary<string, FieldInfo> DicFields
        {
            get
            {
                return this.dicFields;
            }
            set
            {
                this.dicFields = value;
            }
        }

        public IDictionary<string, LinkTableAttribute> DicLinkTable
        {
            get
            {
                return this.dicLinkTable;
            }
            set
            {
                this.dicLinkTable = value;
            }
        }

        public IDictionary<string, LinkTablesAttribute> DicLinkTables
        {
            get
            {
                return this.dicLinkTables;
            }
            set
            {
                this.dicLinkTables = value;
            }
        }

        public IDictionary<string, PropertyInfo> DicProperties
        {
            get
            {
                return this.dicProperties;
            }
            set
            {
                this.dicProperties = value;
            }
        }

        public FieldInfo[] Fields
        {
            get
            {
                return this.fields;
            }
            set
            {
                this.fields = value;
            }
        }

        public LinkTableAttribute[] LinkTable
        {
            get
            {
                return this.linkTable;
            }
            set
            {
                this.linkTable = value;
            }
        }

        public LinkTablesAttribute[] LinkTables
        {
            get
            {
                return this.linkTables;
            }
            set
            {
                this.linkTables = value;
            }
        }

        public PropertyInfo[] Properties
        {
            get
            {
                return this.properties;
            }
            set
            {
                this.properties = value;
            }
        }

        public TableAttribute Table
        {
            get
            {
                return this.table;
            }
            set
            {
                this.table = value;
            }
        }
    }
}

